<?php

class Db_Tables2_BContractInvoiceSku
{
	function __construct() {
		$this->dealers_db = Zend_Registry::get("dealers_db");
	}
	
	function GetInvoiceAmount($invoice_id)
	{
		$result = 0;
		
		$select = $this->dealers_db->select();
		$select->from("b_contract_invoice_sku", array("sum(apply_value) as sm"));
		$select->where("invoice_id = ?", $invoice_id);
		$row = $this->dealers_db->fetchRow($select);
		
		if($row)
		{
			$result = $row['sm'];
		}
		
		return $result;
	}
}